﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Chowpoo.Sql;

namespace CourseSystem.Core.Entities
{
    [Table(Name = "CommonStudy")]
    public class CommonStudyInfo : IDetach
    {
        public CommonStudyInfo()
        {
            Detach();
        }
        #region Model
        private int _id;
        private string _title = "";
        private int _commoncontentid = 0;
        private DateTime _adddate = DateTime.Now;
        private string _addpeop = "";
        private int _type = 0;

        private EntityRef<CommonContentInfo> _commonContentInfo;

        [System.Data.Linq.Mapping.Association(Storage = "_commonContentInfo", ThisKey = "CommonContentId", OtherKey = "Id", IsForeignKey = true)]
        [XmlIgnore]
        public CommonContentInfo CommonContentInfo
        {
            get { return _commonContentInfo.Entity; }
            set { _commonContentInfo.Entity = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [Column(IsDbGenerated = true, IsPrimaryKey = true, IsVersion = true)]
        public int Id
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("标题")]
        [Required(ErrorMessage = "必须填写")]
        public string Title
        {
            set { _title = value; }
            get { return _title; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public int CommonContentId
        {
            set { _commoncontentid = value; }
            get { return _commoncontentid; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public DateTime AddDate
        {
            set { _adddate = value; }
            get { return _adddate; }
        }
        /// <summary>
        /// 添加人
        /// </summary>
        [Column]
        public string AddPeop
        {
            set { _addpeop = value; }
            get { return _addpeop; }
        }
        /// <summary>
        /// 0案例1PPT2讲授式课件
        /// </summary>
        [Column]
        public int Type
        {
            set { _type = value; }
            get { return _type; }
        }
        #endregion Model

        public void Detach()
        {
            this._commonContentInfo = default(EntityRef<CommonContentInfo>);
        }
    }
}
